package com.pescamillam.kiosco.camera;

import java.awt.Dimension;
import java.awt.image.BufferedImage;

import com.github.sarxos.webcam.Webcam;

public class Camera {
	public BufferedImage takePicture (Webcam webcam) {
		try {
			webcam.open();
			BufferedImage a = webcam.getImage();
			webcam.close();
			return a;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public BufferedImage showCamera () {
		try {
			Webcam webcam = Webcam.getDefault();
			webcam.setViewSize(new Dimension(640, 480));
			webcam.open();
			return webcam.getImage();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
